<template>
  <div class="search-input">
    <el-input
      :placeholder="placeholder"
      v-model="search"
      clearable
      @clear="doSerach"
      @keyup.enter.native="doSerach"  
    >
    </el-input>
    <img src="~assets/img/search.png" class="search-ico" @click="doSerach">
  </div>
</template>

<script>
export default {
  props: {
    placeholder: {
      type: String,
      default: '请输入内容'
    },
  },
  data() {
    return {
      search: '',
    }
  },
  methods: {
    doSerach() {
      this.$emit('search', this.search)
    }
  },
}
</script>

<style lang="stylus">
.search-input {
  width: getPx(280);
  height: getPx(34);
  min-height: 32px;
  position: relative;
  .el-input {
    height: 100%;  
  }
  .el-input__inner {
    background: transparent;
    border-radius: getPx(20);
  }
  .search-ico {
    position: absolute;
    right: getPx(15);
    top: 50%;
    transform: translate(0, -50%);
    width: getPx(20);
    height: getPx(21);
    cursor: pointer;  
  }
  .el-input__clear {
    position: absolute;
    top: 50%;
    right: getPx(30);
    transform: translate(0, -60%);
    // @media all and (max-height: $h) {
    //   transform: translate(0, -60%);
    // }
  }
}
</style>